package clientcore

import (
	"gitee.com/huanghua_2017/blade/build"
	"gitee.com/huanghua_2017/blade/state"
)

func (slf *Core) Version() string {
	return build.Version
}

func (slf *Core) GetALiveConn() int64 {
	return slf.state.GetALiveConn()
}

func (slf *Core) ProxyConnsInfo() map[string]int64 {
	return slf.state.ProxyConnsInfo()
}

func (slf *Core) StartSlave(laddr string, raddr string) error {
	return slf.startSlave(laddr, raddr)
}

func (slf *Core) StopSlave(laddr string) error {
	return slf.stopSlave(laddr)
}

func (slf *Core) GetSlaveInfo() map[string]string {
	ret := map[string]string{}
	conns := slf.state.SlaveConns()
	for k, v := range conns {
		ret[k] = v.Raddr
	}
	return ret
}

func (slf *Core) SlaveConnsInfo() []*state.SlaveConn {
	return slf.state.SlaveConnsInfo()
}
